<?php

class User
{

	public static function find($arr = array())
	{
		global $db;

		if (empty($arr))
		{
			$st = $db->prepare("SELECT * FROM user");
		} else if ($arr['id'])
		{
			$st = $db->prepare("SELECT * FROM user WHERE id=:id");
		} else if ($arr['part'])
		{
			$st = $db->prepare("SELECT * FROM user WHERE part=:part");
		} else
		{
			throw new Exception("Unsupported property!");
		}
		$st->execute($arr);
		$a = $st->fetchAll(PDO::FETCH_CLASS, "User");
//		var_dump($a);
		return $a;
	}

}

?>